AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")

include("shared.lua")

--Called when an entity is no longer touching this SENT.
--Return: Nothing
function ENT:EndTouch(entEntity)
end

--Called when the SENT is spawned
--Return: Nothing

function ENT:Initialize()
	self.Entity:SetModel("models/props_junk/cardboard_box004a.mdl")

	self.Entity:PhysicsInit( SOLID_VPHYSICS )
	self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
	self.Entity:SetSolid( SOLID_VPHYSICS )

	-- self.Entity:SetColor(0,0,0,255)
end

function ENT:SetSpawnName(spawnName)
	self.Entity.SpawnName = spawnName
	self.Entity:SetMaterial('models/debug/debugwhite')
	local color = team.GetColor(spawnName)
	self.Entity:SetColor(color.r,color.g,color.b,color.a)
	
	-- Register Spawn Point
	table.insert(GMS.SpawnPoints, self.Entity)
end

function ENT:GetSpawnName(spawnName)
	return self.Entity.SpawnName
end

function ENT:SpawnPlayer(ply)
	ply:SetPos(self.Entity:GetPos() + Vector(0,0,16))
end

function ENT:CheckSpawn()
	local tracedata = {}
	tracedata.start = self.Entity:GetPos()
	tracedata.endpos = tracedata.start + Vector(0,0,64)
	tracedata.filter = self.Entity
	tracedata.mask = MASK_PLAYERSOLID
	
	local trace = util.TraceLine(tracedata)
	--Msg(trace.Hit)
	return not trace.Hit
end

function ENT:Use(ply)
end

function ENT:AcceptInput(input, ply)
end

--Called when the entity key values are setup (either through calls to ent:SetKeyValue, or when the map is loaded).
--Return: Nothing
function ENT:KeyValue(k,v)
end

--Called when a save-game is loaded.
--Return: Nothing
function ENT:OnRestore()
end

--Called when something hurts the entity.
--Return: Nothing
function ENT:OnTakeDamage(dmiDamage)
end

--Controls/simulates the physics on the entity.
--Return: (SimulateConst) sim, (Vector) linear_force and (Vector) angular_force
function ENT:PhysicsSimulate(pobPhysics,numDeltaTime)
end

--Called when an entity starts touching this SENT.
--Return: Nothing
function ENT:StartTouch(entEntity)
end

--Called when the SENT thinks.
--Return: Nothing
function ENT:Think()
end

--Called when an entity touches this SENT.
--Return: Nothing
function ENT:Touch(entEntity)
end

--Called when: ?
--Return: TRANSMIT_ALWAYS, TRANSMIT_NEVER or TRANSMIT_PVS
function ENT:UpdateTransmitState(entEntity)
end